class=$1

rm -rf ${maf_path}/All_ForMutSig.${class}.maf

## colnums
## https://github.com/getzlab/MutSig2CV
## Start_Position需要替换为Start_position
cat ${maf_path}/*GGA_Filter_funcotated.maf | grep -m 1 Hugo_Symbol | sed 's/Start_Position/Start_position/' \
> ${maf_path}/All_ForMutSig.${class}.MSI.maf

## 以人为单位
## 81为突变的reads数目，需保证有突变
for line in ` cat ${config_path}/tumor_normal.${class}.MSI.list | grep -v Normal | sort -u | tr '\t' ',' ` 
do

Tumor=`echo ${line} | awk -F, '{print $1}'`
Normal=`echo ${line} | awk -F, '{print $2}'`
id=`cat ${config_path}/tumor_normal.class.MSI.list | grep -w ${Normal} | awk -F'\t' '{print $1}' | sort -u`

maf_file=${maf_path}/${Tumor}_${Normal}_GGA_Filter_funcotated.maf

cat ${maf_file} | grep -v -E "##|Hugo_Symbol|#version" | awk -F'\t' '{OFS="\t"}{if($81>0){$16=Normal;print}}' Normal=${id} \
>> ${maf_path}/All_ForMutSig.${class}.MSI.maf

done